package com.docking.heylo.web.controller;


import com.docking.heylo.service.IPostService;
import com.docking.heylo.web.dto.PageDto;
import com.docking.heylo.web.utils.ResultUtil;
import com.docking.heylo.web.vo.BaseVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/***
 * 作品管理
 *
 */
@RestController
@RequestMapping("/post")
public class PostController {

    @Autowired
    private IPostService postService;

    /***
     * 作品列表
     *
     * @return
     */
    @PostMapping("/list")
    public BaseVo list(@RequestBody PageDto pageDto){
        PageInfo<Map<String, Object>> pages = postService.managers_list(pageDto);
        return ResultUtil.success("成功", pages);
    }

    /***
     * 删除作品
     *
     * @param pageDto
     * @return
     */
    @PostMapping("/remove")
    public BaseVo remove(@RequestBody PageDto pageDto){
        postService.remove(pageDto.getId());
        return ResultUtil.success("删除作品成功");
    }















}
